package com.example.design.prototype;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OptionalDataException;
import java.io.Serializable;

public class WeeklyLog implements Cloneable, Serializable{
	private Attachment attacher;
	private String name;
	private String date;
	private String content;
	public Attachment getAttacher() {
		return attacher;
	}
	public void setAttacher(Attachment attacher) {
		this.attacher = attacher;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	
	
	public WeeklyLog clone() {
		Object object = null;
		try {
			object = super.clone();
			return (WeeklyLog)object;
		} catch (CloneNotSupportedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
	
	public WeeklyLog deepClone() {
		try {   
			//将对象写入流中
           ByteArrayOutputStream bao = new  ByteArrayOutputStream();
           ObjectOutputStream oos = new  ObjectOutputStream(bao);
           oos.writeObject(this);
           //将对象从流中取出
           ByteArrayInputStream bis=new  ByteArrayInputStream(bao.toByteArray());
           ObjectInputStream ois;
			ois = new  ObjectInputStream(bis);
           return  (WeeklyLog)ois.readObject();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;   
    }
}
